package msu.erdc.hci;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;

import msu.erdc.hci.customObjects.AccidentObject;
import msu.erdc.hci.customObjects.ContactObject;
import msu.erdc.hci.customObjects.InsuranceObject;
import msu.erdc.hci.customObjects.MediaObject;
import msu.erdc.hci.customObjects.PassengerObject;
import msu.erdc.hci.customObjects.VehicleObject;
import msu.erdc.hci.customObjects.VehicleACObject;

import android.app.Application;

/***
 * this class acts as a singleton and i'm just storing the variables here so they are easily accessed everywhere
 * 
 * these variables are would be replaced by a database if this were for real.
 * @author jamespettitt
 *
 */

public class Global extends Application{
	
	public ArrayList<AccidentObject> accidents;
	public ArrayList<ContactObject> contacts;
	public ArrayList<InsuranceObject> insurances;
	public ArrayList<VehicleObject> vehicles;
	public int counter=0;
	
	@Override
    public void onCreate() {
        // Here you could pull values from a config file in res/raw or somewhere else
        // but for simplicity's sake, we'll just hardcode values
		
		accidents = new ArrayList<AccidentObject>();
		contacts = new ArrayList<ContactObject>();
		insurances = new ArrayList<InsuranceObject>();
		vehicles = new ArrayList<VehicleObject>();
		
		createDummyData();
		
        super.onCreate();
    }
	
	/***
	 * function to fill all of the above arraylists with dummy data
	 */
	private void createDummyData()
	{
		// Vehicle Media
		MediaObject myCarPic = new MediaObject();
		myCarPic.type = MediaObject.PICTURE;
		myCarPic.fileLocation = "cars_reliant_robin";
		
		// Vehicle
		VehicleObject myVehicle = new VehicleObject();
		myVehicle.name = "My Vehicle";
		myVehicle.color = "Black";
		myVehicle.tagNum = "AAA-123";
		myVehicle.tagMonth = 7;
		myVehicle.tagYear = 2012;
		myVehicle.inspectionMonth = 7;
		myVehicle.inspectionYear = 2012;
		myVehicle.selectedInsurancePolicy = "State Farm: 1AS34DSS234ER";
		myVehicle.vin = "4D67z123456";
		myVehicle.make = "Toyota";
		myVehicle.model = "Tundra";
		myVehicle.year = 2010;
		myVehicle.registrationNum = "1234iwh9876";
		myVehicle.mediaList.add(myCarPic);
		vehicles.add(myVehicle);
		
		// Insurance
		InsuranceObject myInsurance = new InsuranceObject();
		myInsurance.companyName = "State Farm";
		myInsurance.policyNum = "1AS34DSS234ER";
		insurances.add(myInsurance);
		
		// Accident
		AccidentObject myAccident = new AccidentObject();
		myAccident.latitude = 32.21245;
		myAccident.longitude = -91.24874;
		myAccident.day = 25;
		myAccident.month = 11;
		myAccident.year = 2011;
		myAccident.street = "Halls Ferry";
		myAccident.nearestIntersection = "Halls Ferry, Culkin";
		myAccident.city = "Vicksburg";
		myAccident.state = "MS";
		myAccident.comments = "Fender Bender";
		
		// Vehicle AC
		VehicleACObject myVehicleAC = new VehicleACObject();
		myVehicleAC.tagNumber = "AAA-123";
		myVehicleAC.vinNumber = "5GZCZ43D13S81715";
		myVehicleAC.make = "Toyota";
		myVehicleAC.model = "Corolla";
		myVehicleAC.year = 2011;
		myVehicleAC.color = "Black";
		
		//Passenger
		
		PassengerObject passenger01 = new PassengerObject();
		passenger01.firstName = "Joe";
		passenger01.lastName = "Jackson";
		passenger01.city = "Vicksburg";
		passenger01.state = "MS";
		passenger01.postal = "39180";
		passenger01.phone = "555 555 5555";
		passenger01.injuryList = new HashMap();
		passenger01.injuryList.put("Arm", "Scrape");
		passenger01.isInjured = true;
		passenger01.isDriver = true;
		
		myVehicleAC.passengerList.add(passenger01);
		
		PassengerObject passenger02 = new PassengerObject();
		passenger02.firstName = "Jack";
		passenger02.lastName = "Johnson";
		passenger02.city = "Vicksburg";
		passenger02.state = "MS";
		passenger02.postal = "39180";
		passenger02.phone = "555 555 5555";
		passenger02.injuryList = new HashMap();
		passenger02.injuryList.put("Arm", "Broken 2 places");
		passenger02.injuryList.put("Head", "Bleed profusely");
		passenger02.isInjured = true;
		passenger02.isDriver = false;
		
		myVehicleAC.passengerList.add(passenger02);
		
		myAccident.reportItemList.vehicleList.add(myVehicleAC);
		
		accidents.add(myAccident);
		
		ContactObject myContact = new ContactObject();
		myContact.category = "911";
		myContact.cityState = "City, State";
		myContact.emailaddress = "address@email.com";
		myContact.firstname = "Jane";
		myContact.lastname = "Doe";
		myContact.mobile = "555-555-5555";
		myContact.phone = "555-555-5556";
		myContact.street = "123 Street";
		contacts.add(myContact);
		
	}
}
